<template>
	<view class="content-class">
		<view class="jkzs-border">
			<view class="jkzs rili">
				<d-rili :custom-option="option3"></d-rili>
				<u-row>
					<view v-for="i in option3" :key="i.title" class="item-type">
						<view class="dot" :style="{backgroundColor:i.color}"></view>
						{{i.title}}
					</view>
				</u-row>
			</view>
		</view>
		<view class="jkzs-border" v-for="(i, iIndex) in cardList" :key="iIndex" @click="skipPublicPage(i)">
			<view class="jkzs">
				<view class="health-card">
					<u-row class="header">
						<u-row>
							<u-image style="margin-right:8px" width="16px" height="16px" :src="i.icon"></u-image>
							{{ i.name }}
						</u-row>
						<u-row>
							<view v-if="iIndex ==  0" @click.stop="()=>{}">
								<u-switch v-model="switchValue" activeColor="#FFD8BB" size="20"></u-switch>
							</view>
							<u-image v-else width="20px" height="20px" src="../../static/images/measuring/arrow.png"></u-image>
						</u-row>
					</u-row>
				</view>
				<u-row v-if="i.subTitle" class="sub-title">{{i.subTitle}}</u-row>
			</view>
		</view>
	</view>
</template>

<script>
	import dRili from "../../components/d-rili.vue"
	export default {
		data() {
			return {
				option3: [{
					title: '经期',
					color: '#FF64BA',
					time: ['2025-03-19', '2025-03-20']
				}, {
					title: '预测经期',
					color: '#EE9060',
					time: ['2025-03-21', '2025-03-22', '2025-03-23', '2025-03-24']
				}, {
					title: '排卵期',
					color: '#54D7A5',
					time: ['2025-03-29']
				}],
				switchValue: true,
				cardList: [{
					name: '姨妈来了',
					icon: require("../../static/images/homePage/jqsz.png"),
				}, {
					name: '经期设置',
					icon: require("../../static/images/homePage/jqsz.png"),
					subTitle: '预测月经期、易孕期、排卵期备份',
					page: 'MenstrualSetting'
				}, {
					name: '孕期设置',
					icon: require("../../static/images/homePage/yqsz.png"),
					subTitle: '预测宝宝高度、重量、推测预产期',
					page: 'PregnancySetting'
				}]
			};
		},
		methods: {
			skipPublicPage(item) {
				if (!item.page) return
				uni.navigateTo({
					url: "/pages/PublicPage/PublicPage?pageConfig=" + JSON.stringify(item)
				})
			}
		},
		components: {
			dRili
		}
	};
</script>

<style scoped lang="scss">
	.content-class {
		padding: 15px;

		.jkzs-border {
			margin-bottom: 0px;
			margin-top: 12px;
		}

		.rili {
			padding: 16px 12px;

			.item-type {
				margin-top: 15px;
				display: inline-flex;
				align-items: center;
				font-size: 12px;
				margin-right: 15px;

				.dot {
					width: 5px;
					height: 5px;
					border-radius: 50%;
					margin-right: 8px;
				}
			}

			::v-deep .riliWrapperBox {
				width: 100% !important;

				.signWrapperCalendarBox {
					background-color: transparent !important;
				}
			}
		}

		.sub-title {

			font-weight: 600;
			font-size: 12px;
			color: #999999;
			margin-top: 7px;
		}

		.health-card {
			.header {
				justify-content: space-between !important;
				font-size: 14px;
			}

			.header .u-row:last-child {
				font-size: 12px;
				color: #FFD8BB;
			}

			::v-deep .u-switch {
				background-color: transparent !important;
				border: 1px solid #FFD8BB;

				.u-switch__bg {
					background-color: transparent !important;
				}

				.u-switch__node {
					background-color: #FFD8BB !important;
				}
			}
		}
	}
</style>